home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / BoxIn wipe.c next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.8 KB  |  54 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define CorrectTime 3
  6.  
  7. pascal short BoxInWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* Basically, there are four bars -- one starts at the top and moves down;
  10.    one starts at the bottom and moves up; one starts at the left and moves
  11.    right; one starts at the right and moves left.  There's a lot of overlap
  12.    of bitcopying, but it's masked by the timing correction */
  13.    
  14. pascal short BoxInWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     Rect        vsource1,vsource2, hsource1, hsource2;
  17.     short            vbar,hbar;
  18.     short            HBarGap,VBarGap;
  19.     
  20.     VBarGap=theWindowWidth/50;
  21.     HBarGap=theWindowHeight/50;
  22.     vbar=boundsRect.left;
  23.     hbar=boundsRect.top;
  24.     vsource1.top=vsource2.top=boundsRect.top;
  25.     vsource1.bottom=vsource2.bottom=boundsRect.bottom;
  26.     hsource1.left=hsource2.left=boundsRect.left;
  27.     hsource1.right=hsource2.right=boundsRect.right;
  28.     while (vbar<boundsRect.left+theWindowWidth/2+VBarGap)
  29.     {
  30.         StartTiming();
  31.         vsource1.left=vbar;
  32.         vsource1.right=vsource1.left+VBarGap;
  33.         vsource2.right=2*boundsRect.left+theWindowWidth-vbar;
  34.         vsource2.left=vsource2.right-VBarGap;
  35.         hsource1.top=hbar;
  36.         hsource1.bottom=hsource1.top+HBarGap;
  37.         hsource2.bottom=2*boundsRect.top+theWindowHeight-hbar;
  38.         hsource2.top=hsource2.bottom-HBarGap;
  39.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  40.             &vsource1, &vsource1, 0, 0L);
  41.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  42.             &hsource1, &hsource1, 0, 0L);
  43.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  44.             &vsource2, &vsource2, 0, 0L);
  45.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  46.             &hsource2, &hsource2, 0, 0L);
  47.         vbar+=VBarGap;
  48.         hbar+=HBarGap;
  49.         TimeCorrection(CorrectTime);
  50.     }
  51.     
  52.     return 0;
  53. }
  54.